package mspbots.hubspot.data.core.contacts;

import lombok.RequiredArgsConstructor;
import mspbots.hubspot.data.core.properties.Property;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;

import java.util.List;

/**
 * data.connector.hubspot.api.contatct.ContactController
 *
 * @author Alex bob(https://github.com/vnobo)
 * @date Created by 2020/3/31
 */
@RestController
@RequestMapping("contacts/{tenantId}")
@RequiredArgsConstructor
public class ContactsController {

    private final ContactsServiceImpl contactService;

    @GetMapping("properties")
    public Flux<Property> properties(@PathVariable Long tenantId) {
        return this.contactService.properties(tenantId);
    }

    @PostMapping("search")
    public Flux<Contact> search(@PathVariable Long tenantId, @RequestBody List<String> emails) {
        return this.contactService.search(tenantId, emails);
    }

}
